home *** CD-ROM | disk | FTP | other *** search
/ Ahoy 1986 March / Ahoy_Magazine_86-03_1986_Double_L.d64 / rooting rout 2 (.txt) < prev    next >
Commodore BASIC  |  2022-10-26  |  294b  |  14 lines

  1. 10 rem  problem #23-2 :
  2. 20 rem    rooting routine
  3. 30 rem  solution by thomson fung
  4. 40 rem
  5. 50 print"to exit, type a # < 1"
  6. 60 input"enter a # from 1 to 65535";d
  7. 70 if d<0 then end
  8. 80 x=100 : rem any initial value > 0
  9. 90 for i=1 to 10
  10. 100 x=.5*(x+d/x)
  11. 110 next i
  12. 120 print"square root of"d"="int(x+.5)
  13. 130 print : print : goto 50
  14.